import {View, Image, Text, Navigator} from '@tarojs/components';
import React from 'react';
import {AtIcon} from 'taro-ui';
import {SiteInfo} from '../../../utils/server.interface';
import {TARO_ENV} from "../../../constants/api";
import './enter-store.scss';

interface EnterStoreType {
  siteInfo: SiteInfo
}

const EnterStoreCar: React.FC<EnterStoreType> = ({siteInfo}) => {
  if (siteInfo && Object.keys(siteInfo).length === 0) {
    return <View />
  }
  return (
    <Navigator className='store-info-box' url={`/other/store/store?sid=${siteInfo.uuid}`}>
      <View className='head'>
        {siteInfo.logo &&
        <Image className='img' src={siteInfo.logo + `${TARO_ENV !== 'h5' ? '?x-oss-process=image/resize,w_40' : ''}`} mode={`${TARO_ENV === 'h5' ? 'scaleToFill' : 'widthFix'}`} />}
        <Text className='span'>{siteInfo.name}</Text>
      </View>
      <View className='a-box'>
        进店逛逛<AtIcon value='chevron-right' size='11' color='#666' />
      </View>
    </Navigator>
  )
}

export default EnterStoreCar
